package anc.server.tankshooter.database;

import java.sql.Connection;
import java.sql.DriverManager;

public class Connect {
	
	public static final String DATABASE_NAME="tankshooterdb";
	public static final String ACCOUNT_TABLE="account";
	public static final String MATCH_TABLE="match";
	public static final String STATISTIC_TABLE="statistic";
	/**
	 * 
	 * @param databaseName : tankshooterdb
	 * @return
	 */
	public static Connection getConnection(String databaseName){
		Connection connection = null;
		try{
			Class.forName("com.mysql.jdbc.Driver");
			String connectionString = "jdbc:mysql://localhost:3306/" +databaseName+"?user=root&password=&characterEncoding=UTF8";
			connection=DriverManager.getConnection(connectionString);
		}catch(Exception ex){
			
		}
		return connection;
	}
	public static Connection getConnection(){
		Connection connection = null;
		try{
			Class.forName("com.mysql.jdbc.Driver");
			String connectionString = "jdbc:mysql://localhost:3306/" + DATABASE_NAME +"?user=root&password=&characterEncoding=UTF8";
			connection=DriverManager.getConnection(connectionString);
		}catch(Exception ex){
			
		}
		return connection;
	}
}
